# -*- coding: utf-8 -*-
# @Time: 2021/11/27 10:16
# @Author: lijinxi
# @File    : distribution.py
# @desc

import numpy as np
import random
import matplotlib.pyplot as plt
import matplotlib as mpl
#mpl.rcParams["font.sans-serif"] = ['SimHei']
mpl.rcParams["axes.unicode_minus"] = False
data = np.load('../traces/1/measure.npy')
print(data[0])


def generation(time_slot_data):
    x = []
    y = []
    random.seed(100)
    for i in range(5):
        for j in range(5):
            for z in range(time_slot_data[i][j]):
                x.append(random.random() + i)
                y.append(random.random() + j)
    return [x, y]


def plt_time_slot(slot_data, i):
    plt.figure()
    axes = plt.gca()
    axes.set_xlim(0, 5)
    axes.set_ylim(0, 5)
    plt.scatter(slot_data[0], slot_data[1], marker='o', c=np.random.randint(2, 5 + 1, size=(200,), dtype=np.int8),
                cmap='tab10')
    plt.grid(ls='--')
    plt.tick_params(labelsize=18)
    plt.xlabel('Longitude', fontsize=18)
    plt.ylabel('Latitude', fontsize=18)
    plt.savefig('../../figures/distribution/data-{}.pdf'.format(i), bbox_inches='tight')


if __name__ == '__main__':
    for i in range(20):
        slot_data = generation(data[i])
        plt_time_slot(slot_data, i)
